import { http } from "@/utils/http";

//模板项列表/api/admin/config/price/user-template-items
export const getAdminTemplateItems = (params?: { keyword?: string }) => {
  return http.request<any>(
    "get",
    "/api/admin/config/price/user-template-items",
    { params }
  );
};

// 创建模板项 /api/admin/config/price/user-template-items
export const createAdminTemplateItem = (data: {
  standardCode: string;
  price: number | string;
}) => {
  return http.request<any>(
    "post",
    "/api/admin/config/price/user-template-items",
    {
      data,
      headers: {
        "Content-Type": "application/x-www-form-urlencoded"
      }
    }
  );
};

// 更新模板项/api/admin/config/price/user-template-items/{itemId}
export const updateAdminTemplateItem = (
  itemId: string,
  data: {
    standardCode: string;
    price: number | string;
  }
) => {
  return http.request<any>(
    "put",
    `/api/admin/config/price/user-template-items/${itemId}`,
    {
      data,
      headers: {
        "Content-Type": "application/x-www-form-urlencoded"
      }
    }
  );
};

// 删除模板项/api/admin/config/price/user-template-items/{itemId}
export const deleteAdminTemplateItem = (itemId: string) => {
  return http.request<any>(
    "delete",
    `/api/admin/config/price/user-template-items/${itemId}`
  );
};
